package cn.xbtop.topic;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;

import javax.jms.JMSException;
import javax.jms.TextMessage;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/6/11 14:36
 */
public class TestTopicConsumer {
    public static void main(String[] args) throws JMSException {
        //加载IOC窗口
        ApplicationContext context = new ClassPathXmlApplicationContext("application-topic.xml");
        //((ClassPathXmlApplicationContext) context).start();

        JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class);
        TextMessage receive = (TextMessage) jmsTemplate.receive();
        System.out.println(receive.getText());

        System.out.println("Topic消息消费者-消费成功----");
        //System.out.println(jmsTemplate);

    }
}
